-
Notifications
You must be signed in to change notification settings - Fork 25
Add @naraku9333's CMakeLists.txt from #41 #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
LB--
commented
Jun 4, 2013
- Resolves cmake #41
- Resolves Centralized makefile/compilation #31
|
I am able to generate makefiles for clang with cmake -G "MinGW Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-std=c++11 -DSTATIC_BUILD=1 . && mingw32-makeHowever, it seems that the includes are off since it can't find SFML or boost on |
|
OK, I've fixed it to have proper include paths - it now compiles correctly. |
|
The only downside is that it takes nightmarishly long because it compiles each *.cpp file separately - is there a way we can get it to combine all *.cpp files together in one invocation of the compiler? (Obviously the *.c files would still be separate) |
|
Do we really need SFML and Boost in the project tree? Users/developers should have them installed in their prefered location and set the root in the cmake options. |
|
The libraries in the project tree are just links to the sfml and boost repositories. Users can download them or not download them by choice (if they already have them) |
|
The changes to CMakeLists.txt expect SFML to be in ChessPlusPlus/lib/SFML. Also, is it possible to init and pull just the json-parser module? |
|
Oh. That shouldn't be then. -Stephen Hall On Jun 4, 2013, at 6:32 PM, "Sean Vogel" notifications@github.com wrote:
|
|
LB said:
How slow is it? It takes roughly the same amount of time to compile for me as with g++ directly. |
The paths can be overridden, right?
From the command line, just
It takes the same amount of time to compile one file as it does to compile them all at once. |
There shouldn't be a default for them imo. We should use cmake's find package function to search for SFML/Boost (on other OSs this works much better than in Windows). If the packages can't be found then the user should set the location. |
|
I do want to use the package finder but I don't know how to use it. I still think it should look in |
|
To use Cmake find_package for SFML you can use this module (Save it in a You can then use that module to find SFML with something like this # Detect and add SFML
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
find_package(SFML 1.6 REQUIRED system window graphics network audio)
target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})First we say where we placed the FindSFML.cmake module. We then request CMake to search the system for the specified modules Then we tell CMake to link to the libraries. On Wed, Jun 5, 2013 at 9:13 AM, LB-- notifications@github.com wrote:
|
|
zereo's post but with fixed formatting:
Zereo EDIT: Updated to better code from the previous one, grabbed this code from here since it suits our purposes I believe https://github.com/LaurentGomila/SFML/wiki/Tutorial%3A-Build-your-SFML-project-with-CMake might just need a few minor changes to search in the ./lib/ folder first for SFML then maybe search the others as a fallback.
|
|
Sorry I wasn't able to get through with the CMake list had a very busy workload lately, but thank you Naraku for writing one up. Also we can use find_package for BOOST even easier since it is a more common library # Can define whatever version we require then whatever libraries we require from boost.
find_package(Boost 1.34.0 REQUIRED system filesystem)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${EXECUTABLE_NAME} ${Boost_LIBRARIES})
endif() |
|
I'm working on adding these in ;) |
|
@Zereo it won't work, it requires SFML to actually be installed, which is completely different from having the source code of SFML. (not to mention completely impossible on Windows) |
|
Hmm I'll dink around with the file when I get home from work a bit and see if I can get the SFML one up and running with Naraku's CMake file. |
We want to use find_package (even if it won't work on windows). |
|
Ideally we all should have the correct version of SFML installed on our computers for our OS. So ideally the CMakelist should just search for SFML on the system. If the user developer that is running the CMakelist doesn't have SFML installed on their machine it is their fault and they need to fix it not us in my opinion. All that find_package() is doing is looking for where SFML is installed on the machine (Or in some cases the projects come with pre-built libraries for systems) then linking them libraries to the executable and including the include directories. I am also not really understanding how it is completely impossible to have SFML installed on a windows machine... |
|
The problem is that it looks for SFML.frameworks in a variety of paths that are not valid paths on Windows. I don't understand why it can't just find a normal SFML directory. As long as it can build for me, you can implement it however you want - if your method fails have it fall back on the current method. |
Windows doesn't have default library paths like OS x and linux machines do. So the FindSFML module won't do anything useful.
That's the plan. |
|
Well one option we could use would be to include a Windows SFML 2.0 Release inside our repo and just dump all the other library files for other OS in along with the Windows libs and then set the CMakelist to search that directory for the library files and include's. This would probably be easiest way I can think of because if we wanted to change out the version of SFML we would just have to replace the files in our repo and update one spot in the CMakeList. we can easily just set where it searches by doing # Set the path to look for SFML in. I just put in a standard path can to show for a example
set(SFMLDIR "${CMAKE_SOURCE_DIR}/lib/SFML-2.0")
# Set where to look for the find_package(SFML) module
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
#Find any version 2.X of SFML
#See the FindSFML.cmake file for additional details and instructions
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()
At least I believe that should work, I am still a novice on this sort of thing especially GITHUB and GIT which I am still struggling to learn. |
|
I was looking into find_package last night and will continue tonight, but I really don't see a problem with just setting SFMLROOT, which will probably be necessary on windows anyway. Users should be responsible for installing dependencies. @LB-- I'll look into incremental build. |
|
Are you able to build and link with MinGW? |
|
No, I get crazy linker errors that I'm trying to figure out. As for my own fork, there's a bug in MinGW with |
|
Its weird you are having so many problems with nuwen and I'm not. Can you try with a fresh download of nuwen and build of sfml? |
That's what I did for that test... |
|
@naraku9333 I rebuilt SFML with MinGW and am using CMake with MinGW, and now everything runs and compiles except when it gets to be times to link. I get this error: It's still looking for .lib, but in SFML/lib/ there are .a files. I have tried both "MinGW Makefiles" and "Unix Makefiles" and both try to find .lib instead of .a, yet both generate .a files when I build SFML. Not only that, but it's actually got them listed as build targets - it's trying to build those files, not just use them. As for the |
|
Actually, I have no idea what I changed, but it's working now - now I just need for fix the linker errors specific to my code. EDIT: Yes! I can finally compile and link! Now to start debugging... (The |
This reverts commit 8d6e0fe.
Timestamps appear as 01:02:03 instead of 1:2:3. Uses std::put_time
…ways work for CMAKE_CXX_FLAGS for reasons I don't know. Clang also requires the use of -stdlib=libc++.
|
I think all main issues have been resolved - I'm going to go ahead and merge this as any more issues should be minor. |
Add @naraku9333's CMakeLists.txt from #41